Skip to content

Fix Gradle task to properly detect Smithy model changes#4326

Merged
rcoh merged 1 commit intomainfrom
fix-gradle-inputs
Oct 6, 2025
Merged

Fix Gradle task to properly detect Smithy model changes#4326
rcoh merged 1 commit intomainfrom
fix-gradle-inputs

Conversation

@rcoh
Copy link
Collaborator

@rcoh rcoh commented Oct 2, 2025

The generateSmithyBuild task was not correctly declaring Smithy model files as inputs, causing it to not regenerate when models changed. This fixes the path resolution and adds an existence check for the input files.

Problem

When running ./gradlew codegen-server-test:assemble, the task would not regenerate the server code when Smithy model files were modified because the Gradle task inputs were not properly declared.

Solution

  • Fixed path resolution from rootProject.projectDir.resolve(it) to project.projectDir.resolve(it) since import paths are relative to the project directory
  • Added existence check to only register files as inputs if they actually exist
  • Updated comment to explain what the code does

Testing

  • Verified that the task now properly detects changes to Smithy model files
  • Confirmed that ./gradlew codegen-server-test:assemble regenerates code when models change

@rcoh rcoh requested review from a team as code owners October 2, 2025 18:12
@github-actions
Copy link

github-actions bot commented Oct 2, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@rcoh rcoh force-pushed the fix-gradle-inputs branch from 22445f6 to 32076d6 Compare October 3, 2025 19:14
@github-actions
Copy link

github-actions bot commented Oct 3, 2025

The generateSmithyBuild task was not correctly declaring Smithy model files
as inputs, causing it to not regenerate when models changed. This fixes
the path resolution and adds an existence check for the input files.
@rcoh rcoh force-pushed the fix-gradle-inputs branch from 32076d6 to c484b2d Compare October 4, 2025 01:01
@rcoh rcoh enabled auto-merge (squash) October 4, 2025 01:23
@github-actions
Copy link

github-actions bot commented Oct 4, 2025

A new generated diff is ready to view.

  • No codegen difference in the AWS SDK
  • No codegen difference in the Client Test
  • No codegen difference in the Server Test
  • No codegen difference in the Server Test Python
  • No codegen difference in the Server Test Typescript

A new doc preview is ready to view.

@rcoh rcoh requested review from aajtodd and drganjoo October 4, 2025 10:55
allCodegenTests.flatMap { it.imports }.forEach { inputs.file(project.projectDir.resolve(it)) }
// Declare Smithy model files as inputs so task reruns when they change
allCodegenTests.flatMap { it.imports }.forEach {
val resolvedPath = project.projectDir.resolve(it)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you actually need this (not that it hurts anything)

@rcoh rcoh merged commit bab3bbb into main Oct 6, 2025
50 checks passed
@rcoh rcoh deleted the fix-gradle-inputs branch October 6, 2025 13:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants